<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>location</title>
</head>
<body>

<input type="button" value="显示当前URL"
       onclick="curLocation()">

<input type="button" value="跳转页面"
       onclick="jump()">

<input type="button" value="刷新页面"
       onclick="reloadPage()">
<input type="button" value="替换页面"
       onclick="replacePage()">
<script>

    function curLocation() {
        console.log(location);
    }

    function jump() {
        location.href = "test.html";
    }

    function reloadPage() {
        location.reload();
    }

    function replacePage() {
        location.replace("http://www.baidu.com");
    }


</script>

</body>
</html>